Skip to content

Fix use-after-free in custom widget destruction #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2025
Merged

Conversation

jserv
Copy link
Contributor

@jserv jserv commented Aug 2, 2025

This commit ensures custom widgets are unregistered from dispatch map before memory is freed. Previously, widget memory could be freed while still registered in the dispatch map, causing crashes when accessing freed widget pointers.

The fix modifies custom_widget_dispatch() to handle TwinEventDestroy, ensuring unregistration occurs before base widget destruction.

Summary by Bito

This pull request fixes a critical memory management bug in custom widgets by modifying the `custom_widget_dispatch` function to correctly handle destruction events. This ensures proper unregistration of widgets from the dispatch map before memory is freed, enhancing the stability of the widget system.

This commit ensures custom widgets are unregistered from dispatch map
before memory is freed. Previously, widget memory could be freed while
still registered in the dispatch map, causing crashes when accessing
freed widget pointers.

The fix modifies custom_widget_dispatch() to handle TwinEventDestroy,
ensuring unregistration occurs before base widget destruction.
@jserv jserv merged commit 3a95678 into main Aug 2, 2025
6 checks passed
@jserv jserv deleted the fix-widget-memory branch August 2, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant